﻿<?php

try
{

	//$pdo = new PDO("mysql:host=mysql.kukew.info;dbname=u425924758_bjyxl", "u425924758_bjyxl", "123123");
	$pdo = new PDO("mysql:host=127.0.0.1;dbname=bjyxlshuju", "root", "bjyxl!@#QYGLadmin51909199");
	$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
	$pdo->query("set names utf8"); 
	$cmd= json_decode($GLOBALS["HTTP_RAW_POST_DATA"]);
	if($cmd!=null)
	{
		$statement = $pdo->prepare($cmd->SqlTxt, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
		
		foreach($cmd->SqlParas as $SqlPara)
		{
			$statement->bindParam($SqlPara->Key,$SqlPara->Value);
		}
		$statement->execute();
		$result = array();  
		while($row = $statement->fetch(PDO::FETCH_ASSOC)){  
			array_push($result, $row);  
		}  
		
		echo json_encode($result);  
		
	}
	
}
catch(Exception $e)
{
	echo json_encode("Failed: " . $e->getMessage());
}

?>

